#include <algorithm>
#include <iostream>
#include <cstdio>

#define MAXN 200010

using namespace std;

int a[MAXN];

inline int read(){
int x=0,f=1;
char ch=getchar();
while (ch<'0'||ch>'9') {if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9') {x=x*10+ch-48;ch=getchar();}
return x*f;
}

int main(){
    int n;
    int front,cnt = 1;
    cin >> n;
    for(int i = 1; i <= n; i++){
        a[i] = read();
    }
    sort(a+1, a+n+1);
    front = a[1];
    for(int i = 2; i <= n; i++){
        if(a[i] == front){
            cnt++;
        }
        else{
            printf("%d %d\n", front, cnt);
            cnt = 1;
            front = a[i];
        }
    }
    printf("%d %d\n", front, cnt);
    return 0;
}